package mysql

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	GoodName       string  `gorm:"type:varchar(15);not null;comment:商品名称"`
	GoodNum        string  `gorm:"type:varchar(15);not null;comment:商品编号"`
	GoodPrice      float64 `gorm:"type:decimal(10,2);not null;comment:商品价格"`
	GoodStock      int64   `gorm:"type:int;not null;comment:商品库存"`
	GoodCollection int64   `gorm:"type:int;not null;comment:商品收藏数量"`
}

func (g *Good) GoodInfo(GoodId int64) error {
	return DB.Where("id = ?", GoodId).Limit(1).Find(&g).Error
}
